home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / Jotto2.so Folder / Jotto ][ ƒ / Wipes, etc. / Circular wipe.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-02  |  3.6 KB  |  135 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Circular wipe.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8.  
  9. Jotto ][ -=- a simple word game, revisited
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30. #include "wipe dispatch.h"
  31.  
  32. #define BlockSize 17
  33. #define CorrectTime 1
  34.  
  35. /* Trace a region from the center to the topleft corner, over <BlockSize> pixels,
  36.    and back to the center.  Fill that in and move the region parameters +BlockSize.
  37.    Repeat for all sides. */
  38.  
  39. void CircularWipe(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, short theWindowHeight, short theWindowWidth)
  40. {
  41.     RgnHandle    curregion;
  42.     Rect        source;
  43.     short            cx,cy,gap,lastx,lasty;
  44.     
  45.     cx = theWindowWidth / 2;
  46.     cy = theWindowHeight / 2;
  47.  
  48.     curregion=NewRgn();
  49.     source.top=source.left=0;
  50.     source.bottom=theWindowHeight;
  51.     source.right=theWindowWidth;
  52.     
  53.     gap=BlockSize;
  54.     lastx=0;
  55.     do                                            /* top quadrant */
  56.     {
  57.         StartTiming();
  58.         SetEmptyRgn(curregion);
  59.         MoveTo(cx,cy);
  60.         OpenRgn();
  61.             LineTo(lastx,0);
  62.             LineTo(gap,0);
  63.             LineTo(cx,cy);
  64.         CloseRgn(curregion);
  65.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  66.             &source, &source, 0, curregion);
  67.         lastx=gap;
  68.         gap+=BlockSize;
  69.         TimeCorrection(CorrectTime);
  70.     }
  71.     while (gap<theWindowWidth+BlockSize);
  72.     
  73.     gap=BlockSize;
  74.     lasty=0;
  75.     do                                            /* right quadrant */
  76.     {
  77.         StartTiming();
  78.         SetEmptyRgn(curregion);
  79.         MoveTo(cx,cy);
  80.         OpenRgn();
  81.             LineTo(theWindowWidth,lasty);
  82.             LineTo(theWindowWidth,gap);
  83.             LineTo(cx,cy);
  84.         CloseRgn(curregion);
  85.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  86.             &source, &source, 0, curregion);
  87.         lasty=gap;
  88.         gap+=BlockSize;
  89.         TimeCorrection(CorrectTime);
  90.     }
  91.     while (gap<theWindowHeight+BlockSize);
  92.     
  93.     lastx=theWindowWidth;
  94.     gap=theWindowWidth-BlockSize;
  95.     do                                            /* bottom quadrant */
  96.     {
  97.         StartTiming();
  98.         SetEmptyRgn(curregion);
  99.         MoveTo(cx,cy);
  100.         OpenRgn();
  101.             LineTo(lastx,theWindowHeight);
  102.             LineTo(gap,theWindowHeight);
  103.             LineTo(cx,cy);
  104.         CloseRgn(curregion);
  105.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  106.             &source, &source, 0, curregion);
  107.         lastx=gap;
  108.         gap-=BlockSize;
  109.         TimeCorrection(CorrectTime);
  110.     }
  111.     while (gap>-BlockSize);
  112.     
  113.     lasty=theWindowHeight;
  114.     gap=theWindowHeight-BlockSize;
  115.     do                                            /* left quadrant */
  116.     {
  117.         StartTiming();
  118.         SetEmptyRgn(curregion);
  119.         MoveTo(cx,cy);
  120.         OpenRgn();
  121.             LineTo(0,lasty);
  122.             LineTo(0,gap);
  123.             LineTo(cx,cy);
  124.         CloseRgn(curregion);
  125.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  126.             &source, &source, 0, curregion);
  127.         lastx=gap;
  128.         gap-=BlockSize;
  129.         TimeCorrection(CorrectTime);
  130.     }
  131.     while (gap>-BlockSize);
  132.     
  133.     DisposeRgn(curregion);
  134. }
  135.